<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<jsp:directive.page import="com.anhry.app.safety.util.Util"/>
<%@ include file="/WEB-INF/pages/share/taglib.jsp"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>企业分级评定查看</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link href="<%=basePath+Util.SKIN%>/css/right.css" type="text/css" rel="stylesheet">
	<script type="text/javascript" src="<%=basePath%>/js/jquery-1.7.2.js"></script>
	<script type="text/javascript" src="<%=basePath%>/js/dbdialog/lhgdialog.js"></script>
	<script type="text/javascript" src="<%=path%>/js/table_span.js"></script>
	<script type="text/javascript" src="<%=path%>/js/check_jquery.js"></script>
	<script type="text/javascript" src="<%=path%>/js/util.js"></script>
	<script type="text/javascript" src="<%=path%>/js/My97DatePicker/WdatePicker.js" defer="defer"></script><base target="_self" />
	<script type="text/javascript">
		var numstr = /^([0-9](\.[0-9])?)*$/;//数字
		
		function zpFun(objId){
			var num_v=$("#number_"+objId).val();
			if((numstr.exec($.trim(num_v))==null) && ($.trim(num_v).length!=0)){
				alert('必须为数字');
				$("#number_"+objId).focus();
			}else{
				if( parseInt($("#score_"+objId).text()) < parseInt(num_v) ){
					alert('该项为不合格项，得分必须小于标准分值'+$("#score_"+objId).text()+'分');
				 	$("#number_"+objId).focus();
				 }
			}
		}
		
		function doSelect(obj1,obj2,obj3,objId){
			if(document.getElementById(obj1).checked){
				$("#"+obj2).attr("checked",false);
				$("#"+obj3).attr("checked",false);
				var tem = $("#"+obj1).val();
				var temArry = tem.split(',');
				$("#checks_"+objId).val(temArry[1]);
				if(temArry[1]==1){//合格
					$("#number_"+objId).attr("readonly",true);
					$("#kfmsg_"+objId).attr("readonly",true);
					$("#kfmsg_"+objId).val('');
					$("#number_"+objId).val($("#score_"+objId).text());
				}else if(temArry[1]==3){
					$("#number_"+objId).val('');
					$("#number_"+objId).attr("readonly",true);
					$("#kfmsg_"+objId).attr("readonly",true);
					$("#kfmsg_"+objId).val('');
				}else{
					$("#number_"+objId).val('');
					$("#number_"+objId).attr("readonly",false);
					$("#kfmsg_"+objId).attr("readonly",false);
				}
			}
		}
		
		function funSave(m){
			var tf = false ;
			var tf1 = false ;
			var tf2 = false ;
			var id = '${apply.id }';
			if(m!=4){
				$(".link_input").attr('disabled',true);
			}
			$("#isSubmit").val(m);
			if(m==1){
				var vf =confirm("同意企业自评意见是县(市、区)、开发区行业初审的结果与企业自评结果相同，您确定该操作吗？");
				if(vf){
					document.sdForm.submit();
				}else{
					return;
				}
			}else if(m==2){
				document.sdForm.submit();
			}else if(m==3){
				$("input[id^=checks_]").each(function(i){//数字为必填项
					if($(this).val() == '' || $(this).val() == null ){
						tf = true ;
						$("#tr_"+i).attr("style","background:#b90000");
						$("#"+i+"_1").focus() ;
						return false;
					}else if($(this).val()==2 && $("#number_"+i).val()==""){
						 if($("#number_"+i).val()==""){
						 	$("#tr_"+i).attr("style","background:#b90000");
							 $("#"+i+"_1").focus() ;
							 tf1 = true ;
							 return false;
						 }
					}else if($(this).val()==2 && $("#kfmsg_"+i).val()==""){
						 if($("#kfmsg_"+i).val()==""){
						 	$("#tr_"+i).attr("style","background:#b90000");
							 $("#"+i+"_1").focus() ;
							 tf2 = true ;
							 return false;
						 }
					}else{
						$("#tr_"+i).attr("style","");
					}
				});
				if(tf){
					$(".link_input").attr('disabled',false);
					alert('初审结果有未填写项！');
					return false;
				}else if(tf1){
					$(".link_input").attr('disabled',false);
					alert('不合格项必须填写得分！');
					return false;
				}else if(tf2){
					$(".link_input").attr('disabled',false);
					alert('不合格项必须填写扣分说明！');
					return false;
				}
				if(""==$("#bit1").val() || ""==$("#bit2").val() || ""==$("#bit3").val() || ""==$("#bit4").val() || ""==$("#byear1").val()){
					$(".link_input").attr('disabled',false);
					alert('评审人员或评审人员联系方式未填写！');
					return false;
				}
				document.sdForm.submit();
			}else if(m ==5) {//移送安办
				var vf =confirm("您确定移送到安委办吗？");
				if(vf){
					infoDialog('yhBack','移送县(市、区)、开发区安委办','550','320','<%=basePath%>/fjpd/_hyBack.action?objId='+id+'');
				}else{
					return;
				}
			}else{//打回
				var vf =confirm("您确定要打回该企业的自评信息吗？");
				if(vf){
					infoDialog('sdBack','企业自评打回','550','320','<%=basePath%>/fjpd/_sdBack.action?objId='+id+'');
				}else{
					return;
				}
			}
		}
	</script>
  </head>
  
  <body onload="_w_table_lefttitle_rowspan('#mytable','1','3');">
	<div  class="body-box">
		<div class="map">
			<div class="map_con">
				您当前的位置：分级评定 &gt; 县(市、区)、开发区行业初审
			</div>
		</div>
		<div id="container">
			<table border="0" cellpadding="0" cellspacing="0" class="mytable">
				<tr><td><font color="red">注意：所有项必须全部填写</font></td></tr>
			</table>
			<table border="0" cellpadding="0" cellspacing="0" class="mytable" align="center" style="width: 80%;float: none;">
				<tr>
					<td style="text-align: center;">企业自评结果：</td>
					<td style="text-align: center;">总项数：${apply.zpHgNum+apply.zpBhgNum+apply.zpBsjNum }</td>
					<td style="text-align: center;">合格项：${apply.zpHgNum }</td>
					<td style="text-align: center;">不合格项：${apply.zpBhgNum }</td>
					<td style="text-align: center;">不涉及项：${apply.zpBsjNum }</td>
					<td style="text-align: center;">得分：${apply.zpScore }</td>
					<td style="text-align: center;">级别：${apply.zpGrade }</td>
				</tr>
				<tr>
					<td style="text-align: center;">县(市、区)、开发区行业初审结果：</td>
					<td style="text-align: center;">总项数：${apply.sdHgNum+apply.sdBhgNum+apply.sdBsjNum }</td>
					<td style="text-align: center;">合格项：${apply.sdHgNum }</td>
					<td style="text-align: center;">不合格项：${apply.sdBhgNum }</td>
					<td style="text-align: center;">不涉及项：${apply.sdBsjNum }</td>
					<td style="text-align: center;">得分：${apply.sdScore }</td>
					<td style="text-align: center;">级别：${apply.sdGrade }</td>
				</tr>
				<tr>
					<th colspan="6">${apply.tabName }</th>
				</tr>
			</table>
			<form action="<%=basePath%>/fjpd/_sdAuditSave.action" name="sdForm" method="post">
		    	<table border="0" cellpadding="0" cellspacing="0" class="mytable" id="mytable">
					<s:if test="%{apply!=null}">
						<thead>
					    	<tr class="fixedHeaderTr">
					     		<th width="6%">评定指标</th>
		    					<th width="14%" colspan=2>评定项目</th>
								<th width="20%">评定内容</th>
								<th width="5%">标准分值</th>
								<th width="11%">评分标准</th>
								<th width="10%">自评结果</th>
								<th width="5%">自评得分</th>
								<th width="10%">初审结果</th>
								<th width="5%">初审得分</th>
								<th width="14%" style="border-right:none">扣分说明</th>
					    	</tr>
				   		</thead>
					   	<tbody>
						<s:if test="%{itemList.size>0}">
						  	<s:iterator id="obj" value="itemList" status="x">
						  		<tr id="tr_${x.index }">
									<td align="center">${obj.itemType1Name }</td>
									<td align="center">${obj.itemType2Name }</td>
									<td align="center">${obj.itemType3 }</td>
									<td>${obj.itemInfo }</td>
									<td id="score_${x.index }" align="center">${obj.itemScore }</td>
									<td>${obj.itemBzh }</td>
									<td align="center">
										<s:if test="%{#obj.zpIsCheck==1}"><font color="green">合格</font></s:if>
										<s:elseif test="%{#obj.zpIsCheck==2}"><font color="red">不合格</font></s:elseif>
										<s:elseif test="%{#obj.zpIsCheck==3}">不涉及</s:elseif>
									</td>
									<td align="center">${obj.zpScore }</td>
									<td>
										<s:if test="%{#obj.sdIsCheck==1}">
											<input type="checkbox" name="sdHg"   id="${x.index }_1"  value="${obj.id },1" onclick="doSelect('${x.index }_1','${x.index }_2','${x.index }_3','${x.index }');" checked="checked">合&nbsp;&nbsp;&nbsp;&nbsp;格<br>
								    		<input type="checkbox" name="sdBhg" id="${x.index }_2"  value="${obj.id },2" onclick="doSelect('${x.index }_2','${x.index }_1','${x.index }_3','${x.index }');">不合格<br>
								    		<input type="checkbox" name="sdBsj"     id="${x.index }_3"  value="${obj.id },3" onclick="doSelect('${x.index }_3','${x.index }_1','${x.index }_2','${x.index }');">不涉及
										</s:if>
										<s:elseif test="%{#obj.sdIsCheck==2}">
											<input type="checkbox" name="sdHg"   id="${x.index }_1"  value="${obj.id },1" onclick="doSelect('${x.index }_1','${x.index }_2','${x.index }_3','${x.index }');">合&nbsp;&nbsp;&nbsp;&nbsp;格<br>
								    		<input type="checkbox" name="sdBhg" id="${x.index }_2"  value="${obj.id },2" onclick="doSelect('${x.index }_2','${x.index }_1','${x.index }_3','${x.index }');" checked="checked">不合格<br>
								    		<input type="checkbox" name="sdBsj"     id="${x.index }_3"  value="${obj.id },3" onclick="doSelect('${x.index }_3','${x.index }_1','${x.index }_2','${x.index }');">不涉及
										</s:elseif>
										<s:elseif test="%{#obj.sdIsCheck==3}">
											<input type="checkbox" name="sdHg"   id="${x.index }_1"  value="${obj.id },1" onclick="doSelect('${x.index }_1','${x.index }_2','${x.index }_3','${x.index }');">合&nbsp;&nbsp;&nbsp;&nbsp;格<br>
								    		<input type="checkbox" name="sdBhg" id="${x.index }_2"  value="${obj.id },2" onclick="doSelect('${x.index }_2','${x.index }_1','${x.index }_3','${x.index }');">不合格<br>
								    		<input type="checkbox" name="sdBsj"     id="${x.index }_3"  value="${obj.id },3" onclick="doSelect('${x.index }_3','${x.index }_1','${x.index }_2','${x.index }');" checked="checked">不涉及
										</s:elseif>
										<s:else>
											<input type="checkbox" name="sdHg"   id="${x.index }_1"  value="${obj.id },1" onclick="doSelect('${x.index }_1','${x.index }_2','${x.index }_3','${x.index }');">合&nbsp;&nbsp;&nbsp;&nbsp;格<br>
								    		<input type="checkbox" name="sdBhg" id="${x.index }_2"  value="${obj.id },2" onclick="doSelect('${x.index }_2','${x.index }_1','${x.index }_3','${x.index }');">不合格<br>
								    		<input type="checkbox" name="sdBsj"     id="${x.index }_3"  value="${obj.id },3" onclick="doSelect('${x.index }_3','${x.index }_1','${x.index }_2','${x.index }');">不涉及
										</s:else>
									</td>
									<td>
										<input type="hidden" name="itemIds" id="itemId_${x.index }" value="${obj.id }">
										<input type="hidden" name="itemChecks" id="checks_${x.index}" value="${obj.sdIsCheck }">
										<s:if test="%{#obj.sdIsCheck==2}"><input type="text" name="sdScore" id="number_${x.index }" value="${obj.sdScore }" size="2" onblur="zpFun('${x.index}');"></s:if>
										<s:else><input type="text" name="sdScore" id="number_${x.index }" value="${obj.sdScore }" size="2" onblur="zpFun('${x.index}');" readonly="readonly"></s:else>
									</td>
									<td>
									<s:if test="%{#obj.sdIsCheck==2}"><textarea rows="4" cols="14" name="sdKfMsg" id="kfmsg_${x.index }">${obj.sdKfMsg }</textarea></s:if>
										<s:else><textarea rows="4" cols="14" name="sdKfMsg" id="kfmsg_${x.index }" readonly="readonly">${obj.sdKfMsg }</textarea></s:else>
									</td>
								</tr>
						  	</s:iterator>
							<tr>
								<td align="center" colspan="4">
									县(市、区)、开发区行业初审人员1：<input type="text" name="sdPer1" value="${apply.sdPer1}" id="bit1"><label class="note4">*</label>
								</td>
								<td align="center" colspan="4">
									联系方式1：<input type="text" name="sdPer1Tel" value="${apply.sdPer1Tel}" id="bit2"><label class="note4">*</label>
								</td>
								<td align="center" rowspan="2" valign="middle" colspan="3">
									初审时间：<input name="sdDate" type="text" class="Wdate" value="<s:date name="%{apply.sdDate}" format="yyyy-MM-dd"/>" onclick="WdatePicker({readOnly:true})" id="byear1" ><label class="note4">*</label>
								</td>
							</tr>	
							<tr>
								<td align="center" colspan="4">
									县(市、区)、开发区行业初审人员2：<input type="text" name="sdPer2" value="${apply.sdPer2}" id="bit3"><label class="note4">*</label>
								</td>
								<td align="center" colspan="4">
									联系方式2：<input type="text" name="sdPer2Tel" value="${apply.sdPer2Tel}" id="bit4"><label class="note4">*</label>
								</td>
							</tr>	
							<tr>
								<td align="center" colspan="11">
									<center>
										<input type="button" name="btntj1" class="link_input" id="btnSubmit1" value="同意企业自评结果" title="该选项为同意企业自评结果" onclick="funSave('1')"/> 
										<input type="button" name="btntj2" class="link_input" id="btnSubmit2" value="保 存" title="初审结果暂存" onclick="funSave('2')"/> 
										<input type="button" name="btntj3" class="link_input" id="btnSubmit3" value="提 交" title="初审完成，提交" onclick="return funSave('3')"/> 
										<input type="button" name="btntj4" class="link_input" id="btnSubmit4" value="打 回" title="打回企业重新自评" onclick="funSave('4')"/> 
										<input type="button" name="btntj3" class="link_input" id="btnSubmit3" value="移送县(市、区)、开发区安委办" title="该企业不属于本行业监管范围，移送安委办！" onclick="funSave('5')"/> 
										<input type="button" name="btntj5" class="link_input" id="btnSubmit5" value="返 回" onclick="window.location.href='<%=basePath %>/fjpd/_countryList.action?${urls }&num=${num }&size=${size }'"/> 
									</center>
								</td>
							</tr>	
						</s:if>
					</s:if>
					<s:else>
						<tr>
							<td>该企业的企业类型未对应评级标准，请联系管理部门！</td>
						</tr>
					</s:else>
				</table>
				<input type="hidden" name="objId" value="${apply.id }">
				<input type="hidden" name="isSubmit" id="isSubmit" value="">
				<input type="hidden" name="num" value="${num }">
				<input type="hidden" name="size" value="${size }">
				<input type="hidden" name="urls" value="${urls }">
			</form>
		</div>
	</div>
	
	<form action="<%=basePath %>/fjpd/_countryList.action?search=1" name="form1" method="post">
		<input type="hidden" name="urls" value="${urls }">
		<input type="hidden" name="num" value="${num }">
		<input type="hidden" name="size" value="${size }">
	</form>
  </body>
  <s:if test="%{tip!=null}">
    	<script>
    		msgDialog('${tip}', 'i.png');
    	</script>
    </s:if>
</html>
